Xbasic

A5_imageURL_from_blob Function

Syntax

c URL = a5_imageURL_from_blob(blob as b, imageTypeIn as c, imageTypeOut = "" )

Arguments

imageTypeIn

The image type (jpg, bmp, png)

imageTypeOut

The image type you want to return.

Description

Takes a blob (image data) and creates a URL for the image. A use case for this function would be if you had a table that contained a binary field with some image data in it. You would like to display this image in some html.

Example

<%a5
dim cn as sql::connection
cn.open("::name::myconnection")
dim sql as c 
sql = "select imageblob from products where productid = 1")
cn.execute(sql)
dim b as b 
b = cn.resultset.data("imageblob")
dim url as c 
url = a5_imageURL_from_blob(b,"jpg","jpg")
?"<img src=" + quote(url) + " />"
%>